#include<iostream>
#include<algorithm>
#include<cstring>
#include<unordered_set>
#include<set>
#include<map>
using namespace std;
typedef long long LL;
const int N = 1e5 + 10, M = 2e5 + 10;
int h[N], e[M], ne[M], idx;
int a[M], b[M];
int d[N];
int st[N];
map<LL, int>mp;
int n, m;
void add(int a, int b)
{
	e[idx] = b, ne[idx] = h[a], h[a] = idx++;
}
int main()
{
	cin >> n >> m;
	memset(h, -1, sizeof(h));
	for (int i = 1; i <= m; i++) {
		scanf("%d%d", &a[i], &b[i]);
		d[a[i]]++, d[b[i]]++;
	}
	for (int i = 1; i <= m; i++) {
		int x = a[i], y = b[i];
		if (d[x] > d[y])swap(x, y);
		else if (d[x] == d[y] && (x > y))swap(x, y);
		add(x, y);
	}
	LL ans = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = h[i]; ~j; j = ne[j]) {
			int k = e[j];
			st[k] = i;
		}
		for (int j = h[i]; ~j; j = ne[j]) {
			int k = e[j];
			for (int z = h[k]; ~z; z = ne[z]) {
				int k1 = e[z];
				if (st[k1] == i) {
					ans++;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}